from ECShop_no9_自动化测试.common.base import create_browser,Base
from ECShop_no9_自动化测试.common.base import create_browser_op
import time
class Page_message_list(Base):
    url = 'http://localhost:8080/ecshop/user.php'
    message_click=('xpath',"//div[@class='userCenterBox']/div/a[6]")
    title_input=('xpath',"//input[contains(@size,'30')]")

    # title_input=('xpath',"//input[@name='msg_title' and @class='inputBg'")
    content_input=('xpath',"//textarea[@name='msg_content']")
    tij_click=('xpath',"//input[@type='submit' and @class='bnt_bonus']")
    message_is_success=('xpath',"//div[@class='userCenterBox boxCenterList clearfix']/div[3]") #获取文本
    def page_message_web(self):
        self.base_open_web(self.url)
    #点击留言
    def page_message_click(self):
        self.base_click(self.message_click)
    #点击主题输入框
    def page_meaasge_input_title(self,your_content):
        self.base_input_content(self.content_input,your_content)
    #点击内容输入框
    def page_message_input(self,your_content):
        self.base_input_content(self.content_input,your_content)
    #点击提交
    def page_meaasge_tijiao_click(self):
        self.base_click(self.tij_click)
    #关闭
    def page_message_quit(self):
        self.base_quit()
    def page_message_is_success(self):
        self.base_get_text(self.message_is_success)

if __name__ == '__main__':
    p1=Page_message_list(create_browser_op(r'C:\Users\86183\AppData\Local\Google\Chrome\User Data'))
    p1.page_message_web()
    p1.page_message_click()
    # time.sleep(3)
    p1.page_meaasge_input_title('服装有瑕疵')
    time.sleep(3)
    p1.page_message_input('服装有瑕疵,请尽快处理')
    time.sleep(3)
    p1.page_meaasge_tijiao_click()
    time.sleep(4)
    p1.page_message_is_success()
    # p1.page_message_quit()
